<script setup>
import { ref, watch } from 'vue'
import { usePopStore } from '@/stores'
import { storeToRefs } from 'pinia'
const popStore = usePopStore()
const { Equipment, XY } = storeToRefs(popStore)
const close = () => {
  Equipment.value.showPop = false
}
const dialogPosition = ref([0, 0])
watch(
  Equipment.value,
  (newVal) => {
    if (newVal) {
      dialogPosition.value = XY.value
    }
  },
  {
    deep: true
  }
)
</script>
<template>
  <transition
    appear
    name="custom-classes-transition"
    enter-active-class="animate__animated  animate__fadeIn"
    leave-active-class="animate__animated animate__faster  animate__fadeOut"
  >
    <div
      class="AirspacePop"
      ref="currentDom"
      :style="{
        left: dialogPosition[0] + 'px',
        top: dialogPosition[1] + 'px'
      }"
      v-if="false"
    >
      <p class="title">
        <span>视频监控</span>
        <span @click="close"><img src="@img/pop/close_icon.png" alt="" /></span>
      </p>
      <div class="content">
        <img src="@img/pop/play_btn.png" />
      </div>
    </div>
  </transition>
</template>
<style scoped lang="scss">
.AirspacePop {
  position: absolute;
  z-index: 9;
  top: 50%;
  left: 50%;
  width: 328px;
  height: 219px;
  background: url('@img/pop/airspace_bg.png');
  background-size: 100% 100%;

  .title {
    display: flex;
    padding: 10px 20px 10px 50px;
    align-items: center;
    font-size: 16px;
    justify-content: space-between;

    span:last-child {
      width: 18px;
      height: 18px;
      cursor: pointer;

      img {
        width: 100%;
        height: 100%;
      }
    }
  }

  .content {
    margin-top: 5px;
    margin: 12px;
    height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 213, 255, 0.12);
    box-shadow: inset 0px 0px 28px 0px rgba(0, 213, 255, 0.42);
    border: 3px solid #2c8596;

    img {
      width: 37px;
      height: 37px;
    }
  }
}
</style>
